package com.atguigu.stgy.admin.service.impl;

import com.atguigu.stgy.admin.mapper.ViewAppointmentMapper;
import com.atguigu.stgy.admin.service.ViewAppointmentService;
import com.atguigu.stgy.model.dto.AppointmentSearchDTO;
import com.atguigu.stgy.model.entity.ViewAppointment;
import com.atguigu.stgy.model.vo.AppointmentVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ViewAppointmentServiceImpl extends ServiceImpl<ViewAppointmentMapper, ViewAppointment> implements ViewAppointmentService {

    @Override
    public Page<AppointmentVO> pageItem(AppointmentSearchDTO searchDTO) {
        Page<AppointmentVO> page = new Page<>(searchDTO.getCurrent(), searchDTO.getSize());
        List<AppointmentVO> appointmentVOS = baseMapper.selectAppointmentVOByCondition(page , searchDTO);
        page.setRecords(appointmentVOS);
        return page;
    }
}